package com.nikkerball.apps.darkhorse.model.core;

import com.nikkerball.apps.darkhorse.model.base.NameObject;
import org.hibernate.annotations.Cascade;

import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.List;

import static org.hibernate.annotations.CascadeType.*;

/**
 * Represents a School Classroom
 */
@Entity
@Table(name = "Classroom")
public class Classroom extends NameObject {

    // ----- instance fields -----

    private List<ClassYear> classYears;

    // ----- constructors -----

    public Classroom() {
        super();
    }

    public Classroom(String name) {
        super(name);
    }

    // ----- public methods -----

    @OneToMany(mappedBy = "classroom")
    @Cascade({MERGE, PERSIST, SAVE_UPDATE, DETACH, DELETE})
    public List<ClassYear> getClassYears() {
        return this.classYears;
    }

    public void setClassYears(List<ClassYear> classYears) {
        this.classYears = classYears;
    }

}
